#include <bits/stdc++.h>
using namespace std;
int x,y,arr[8]={0},day=0;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	for(int i=1;i<=7;i++){
		cin>>x>>y;
		arr[i] +=x+y-8;
	}
	for(int i=1;i<7;i++){
		if(arr[i]>arr[day]){
			day = i;
		}
	}
	cout<<day;
	return 0;
	
}
//5 3
//6 2
//7 2
//5 3
//5 4
//0 4
//0 6
